import request from '@/utils/request';
//用户列表
export const getusersall = (offset, limit) => {
  return request({
    method: 'get',
    url: '/v1/users/list?offset=' + offset + '&limit=' + limit,
  });
};

export const getallusers = () => {
  return request({
    method: 'get',
    url: '/v1/users/count',
  });
};

//管理员列表
export const getadminall = (offset, limit) => {
  return request({
    method: 'get',
    url: '/admin/all?offset=' + offset + '&limit=' + limit,
  });
};

export const getalladmin = () => {
  return request({
    method: 'get',
    url: '/admin/count',
  });
};

//订单列表
export const getorderformlistall = (offset, limit) => {
  return request({
    method: 'get',
    url: '/bos/orders?offset=' + offset + '&limit=' + limit,
  });
};

export const getallorderformlist = () => {
  return request({
    method: 'get',
    url: '/bos/orders/count',
  });
};

export const getbusinessinfo = (id) => {
  return request({
    method: 'get',
    url: '/shopping/restaurant/' + id,
  });
};

export const getuserinfo = (id) => {
  return request({
    method: 'get',
    url: '/v1/user/' + id,
  });
};

export const getaddresse = (id) => {
  return request({
    method: 'get',
    url: '/v1/addresse/' + id,
  });
};

//商家列表
export const getbusinesslist = (offset, limit) => {
  return request({
    method: 'get',
    url: '/shopping/restaurants?latitude=28.227779&longitude=112.938858&offset=' + offset + '&limit=' + limit,
  });
};

export const getbusinesscount = () => {
  return request({
    method: 'get',
    url: '/shopping/restaurants/count',
  });
};

export const getbusinessclassify = () => {
  return request({
    method: 'get',
    url: '/shopping/v2/restaurant/category',
  });
};

export const delbusiness = (id) => {
  return request({
    method: 'delete',
    url: '/shopping/restaurant/' + id,
  });
};

export const postbusiness = (content) => {
  return request({
    method: 'post',
    url: '/shopping/updateshop',
    data: {
      content,
    },
  });
};

//食品列表
export const getfoodlist = (offset, limit, id) => {
  return request({
    method: 'get',
    url: '/shopping/v2/foods?offset=' + offset + '&limit=' + limit + '&restaurant_id=' + id,
  });
};

export const getfoodcount = () => {
  return request({
    method: 'get',
    url: '/shopping/v2/foods/count',
  });
};

export const getfoodmenu = (id) => {
  return request({
    method: 'get',
    url: '/shopping/v2/menu/' + id,
  });
};


export const getfoodclassify = () => {
  return request({
    method: 'get',
    url: '/shopping/v2/menu?restaurant_id=1&allMenu=true',
  });
};

export const delfood = (id) => {
  return request({
    method: 'delete',
    url: '/shopping/v2/food/'+id,
  });
};

export const postfood=(content)=>{
  return request({
      method:'post',
      url:'/shopping/v2/updatefood',
      data:{
          content
      }
  })
}



//用户分布
export const getyhfb = () => {
  return request({
    method: 'get',
    url: '/v1/user/city/count',
  });
};
